home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 22
/
Cream of the Crop 22.iso
/
program
/
pce32dll.zip
/
PCEDLL
/
VBASIC
/
VBDEMO~1.FRM
< prev
Wrap
Text File
|
1996-10-22
|
3KB
|
96 lines
VERSION 4.00
Begin VB.Form Form1
Caption = "PCE32.DLL Demo"
ClientHeight = 4140
ClientLeft = 1140
ClientTop = 1515
ClientWidth = 6870
Height = 4545
Left = 1080
LinkTopic = "Form1"
ScaleHeight = 4140
ScaleWidth = 6870
Top = 1170
Width = 6990
Begin VB.CommandButton Command2
Caption = "TimeTwo "
Height = 495
Left = 2760
TabIndex = 0
Top = 2520
Width = 1215
End
End
Attribute VB_Name = "Form1"
Attribute VB_Creatable = False
Attribute VB_Exposed = False
'Declare the function TimesTwo , which is in the PCE32.DLL.
'Note PCE32.DLL should be in one of the following
' 1) The current directory
' 2) The Path
' 3) The Windows or Windows\System Directory
' The recommended place is in your Windows\System Directory
'*******************************************************************
'* *
'* HERE'S A USEFUL TIP *
'* *
'*******************************************************************
' Win32 (32s/Win95/WinNT) thinks that integers are 32bit
' Visual Basic 4.0 treats integers as 16bit , this could cause
' you some problems should you try to call a function in a DLL
' from VB that takes or returns an integer unless youre aware of
' (it took some headscratching to figure it out).
'
' Instead of declaring it as an integer declare it as long.
'
' You should also use Long for any other Handles etc that you have
' to pass.
'
' Another tip is that VB4 is case sensitive when it comes to DLL names
' EG :- PCE32.DLL is not the same as Pce32.Dll
Private Declare Function TimesTwo Lib "PCE32.DLL" (ByVal X As Integer) As Long
Private Sub Command2_Click()
' Call the Fuction TimesTwo
X = TimesTwo(300)
' and display the result in a MessageBox
msg = "Returned value is " & X
y = MsgBox(msg, 64, "PCE32 Demo")
End Sub
Private Sub Form_Load()
Show
Cls
Print
Print " This is a very basic example of how to call the PCE32.Dll , simply click on the TimesTwo button"
Print " below and the TimesTwo function in the DLL will be called , the result of the call will then be"
Print " displayed in a MessageBox."
Print
Print " Try changing the value of TimesTwo (in this case its 300) to get different results."
Print
Print
End Sub